@ECHO OFF
%0 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
wmic ENVIRONMENT create name="JAVA_HOME",username="<system>",VariableValue="C:\Users\Administrator\jmeterEnv\JDK1.8"
wmic ENVIRONMENT create name="JMETER_HOME",username="<system>",VariableValue="C:\Users\Administrator\jmeterEnv\jmeter\apache-jmeter-5.1.1"
wmic ENVIRONMENT where "name='path'" delete
wmic ENVIRONMENT create name="path",username="<system>",VariableValue="%PATH%;C:\Users\Administrator\jmeterEnv\JDK1.8\bin;C:\Users\Administrator\jmeterEnv\JDK1.8\lib\dt.jar;C:\Users\Administrator\jmeterEnv\JDK1.8\lib\tools.jar;C:\Users\Administrator\jmeterEnv\jmeter\apache-jmeter-5.1.1\bin;C:\Users\Administrator\jmeterEnv\jmeter\apache-jmeter-5.1.1\lib\logkit-2.0.jar;C:\Users\Administrator\jmeterEnv\jmeter\apache-jmeter-5.1.1\lib\jorphan.jar;C:\Users\Administrator\jmeterEnv\jmeter\apache-jmeter-5.1.1\lib\ext\ApacheJMeter_core.jar"
rem 注册表修改：
REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters /v MaxUserPort /d 65534 /t REG_DWORD /f  
REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters /v TcpTimedWaitDelay /d 30 /t REG_DWORD /f 

::创建环境变量  ssh远程执行，需要把 %1 改成 %0 ，并且用administrator用户执行

echo. 显示java 环境的版本
echo.-------------------------
java -version
echo.-------------------------
echo.
shutdown /r /t 1
pause